<?php session_start(); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Edit Check-in</title>
<script type="text/javascript" src="validateInformation.js" >
</script>

<?php
require_once 'UpdateManager.php';
if(isset($_POST['Done']))
{
	$snum = $_SESSION['snum'];
	$date=$_POST['chkDate'].$_POST['chkMonth'].$_POST['chkYear'];
	$term=$_POST['dateCheckin'];
	$room=$_POST['roomNo'];
	$fname=$_POST['firstName'];
	$mname=$_POST['middleName'];
	$lname=$_POST['lastName'];
	
	$f = UpdateManager::updateCheckin($snum,$date,$term,$room,$fname,$mname,$lname);
	if($f){
		UpdateManager::showMessage($f);
	}else{
		UpdateManager::showMessage(0);
	}
	
}
?>

<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="100%" border="0" cellpadding="1">
 
  <tr>
    <td>&nbsp;</td>
    <td class="subBanner"><strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Edit Resident Check-in</strong></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><form id="form1" name="form1" method="post" onsubmit="return validateInformation4(this)" action="">
      <table width="100%" border="0" cellpadding="1">
        <tr>
          <td>Last Name</td>
          <td width="34%"><input name="lastName" type="text" id="lastName" size="40" value="<?php echo $_SESSION['last']?>" />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td id="date4" class="error">&nbsp;</td>
        </tr>
        <tr>
          <td>First Name</td>
          <td><input name="firstName" type="text" id="firstName" size="40" value="<?php echo $_SESSION['first']?>"/>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td id="date3" class="error">&nbsp;</td>
        </tr>
        <tr>
          <td>Middle Name</td>
          <td><input name="middleName" type="text" id="firstName2" size="40" value="<?php echo $_SESSION['middle']?>"/>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td id="date2" class="error">&nbsp;</td>
        </tr>


	  <tr>
		
		 <?php
			$dd=substr($_SESSION['date_in'],0,2);			
			$mm=substr($_SESSION['date_in'],2,3);
			$yy=substr($_SESSION['date_in'],5,4);
		  ?>
		
          <td width="37%"><strong>Date Check-In</strong></td>
          <td width="34%"><strong>
		  <select name="chkMonth" id="chkMonth">
			  <option value="JAN" <?php if($mm=='JAN')echo "selected='selected'"?>>January</option>
              <option value="FEB" <?php if($mm=='FEB')echo "selected='selected'"?>>February</option>
              <option value="MAR" <?php if($mm=='MAR')echo "selected='selected'"?>>March</option>
              <option value="APR" <?php if($mm=='APR')echo "selected='selected'"?>>April</option>
              <option value="MAY" <?php if($mm=='MAY')echo "selected='selected'"?>>May</option>
              <option value="JUN" <?php if($mm=='JUN')echo "selected='selected'"?>>June</option>
              <option value="JUL" <?php if($mm=='JUL')echo "selected='selected'"?>>July</option>
              <option value="AUG" <?php if($mm=='AUG')echo "selected='selected'"?>>August</option>
              <option value="SEP" <?php if($mm=='SEP')echo "selected='selected'"?>>September</option>
              <option value="OCT" <?php if($mm=='OCT')echo "selected='selected'"?>>October</option>
              <option value="NOV" <?php if($mm=='NOV')echo "selected='selected'"?>>November</option>
              <option value="DEC" <?php if($mm=='DEC')echo "selected='selected'"?>>December</option>
            </select>
&nbsp;
<label for="bdDay"></label>
<label for="chkDate"></label>
<input name="chkDate" type="text" id="chkDate" size="3" value="<?php echo $dd;?>" />
&nbsp;
<label for="chkYear"></label>
<select name="chkYear" id="chkYear">

<?php
$ys=1985;
$ye=2011;

for(;$ys <= $ye; $ys++)
{
	echo "<option value='1985'"; if($yy==$ys)echo "selected='selected'"; echo ">" . $ys . "</option>";
}
?>

</select>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          </strong></td>
          <td width="29%" id="date" class="error">&nbsp;</td>
        </tr>
        <tr>
          <td>Term</td>
          <td><strong><input type="radio" name="dateCheckin" id="gender" value="first" <?php if($_SESSION['term']=="FIRST")echo "checked='checked'"?> />

      First Semester 
      <input type="radio" name="dateCheckin" id="gender2" value="second" <?php if($_SESSION['term']=="SECOND")echo "checked='checked'"?>/>
      Second Semester
    <input type="radio" name="dateCheckin" id="gender3" value="summer" <?php if($_SESSION['term']=="SUMMER")echo "checked='checked'"?>/>
      Summer&nbsp;</strong></td>
          <td id="trm" class="error">&nbsp;</td>
        </tr>
        <tr>
          <td>Room Number</td>
          <td><strong>
            <input type="text" name="roomNo" id="roomNo" size="3" value="<?php echo $_SESSION['roomno']?>"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            </strong></td>
          <td id="rn" class="error">&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" name="Done" id="Done" value="Done" /></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td></td>
          <td>&nbsp;</td>
        </tr>
      </table>
    </form></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>